package com.ztrue.framework.disruptor;

import com.lmax.disruptor.EventHandler;

/**
 * 抽象消息处理器
 *
 * @author zhangw
 * @date 2016/11/30 23:09
 * @version: 1.0
 */
public abstract class MessageHandler<M> implements EventHandler<M> {
    @Override
    public void onEvent(M event, long sequence, boolean endOfBatch) throws Exception {
        this.onEvent(event);
    }

    /**
     * 触发事件，将消息发送至对应的消息处理器
     *
     * @param message 消息
     */
    public abstract void onEvent(M message);
}
